import req from '@/utils/request'
import type { AttrInfoDataList } from './model/AttrInfoListType'

enum Api {
  ArrtInfoList = '/admin/product/attrInfoList',
  saveInfoList = '/admin/product/saveAttrInfo',
  delAttr = '/admin/product/deleteAttr',
}

// 获取商品属性得接口
export const getArrtInfoList = (
  category1Id: number,
  category2Id: number,
  category3Id: number
) => {
  return req.get<null, AttrInfoDataList>(
    `${Api.ArrtInfoList}/${category1Id}/${category2Id}/${category3Id}`
  )
}

// 添加商品属性的接口
export const saveAttrInfo = (data: any) => {
  return req.post(Api.saveInfoList, data)
}

// 删除属性的接口
export const delAttrApi = (attrId: number) => {
  return req.delete<null, null>(`${Api.delAttr}/${attrId}`)
}
